package com.efast.cafe.portal.controller.api;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.efast.cafe.framework.controller.AbstractController;
import com.efast.cafe.framework.vo.DataTableVo;
import com.efast.cafe.portal.bean.api.ApiRequestUriBean;
import com.efast.cafe.portal.bean.api.ApiRequestUriQueryBean;
import com.efast.cafe.portal.service.api.IApiRequestUriService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/frame_center/api")
public class ApiRequestUrlController extends AbstractController{
	
	@Autowired
	private IApiRequestUriService apiRequestUriService;
	
	
	
	/**
	 * 页面跳转
	 * @param searchValue
	 * @param model
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/url/page")
	public String templatePage(@RequestParam(required = false) String searchValue, ModelMap model,
			HttpServletRequest request, HttpServletResponse response){
		
		return "/api/url/list";
	}
	
	/**
	 *  通过完整url查询请求路径
	 * @param queryBean
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/url/list")
	public @ResponseBody  DataTableVo<ApiRequestUriBean> urlPageList(@ModelAttribute ApiRequestUriQueryBean queryBean, 
			HttpServletRequest request, HttpServletResponse response){
	
		return outPageJSONArray_bootstrapDatatable(apiRequestUriService.urlPageList(queryBean));
	}
}
